package restaurant;

import GUI.SimulatorGUI;
import IA.InformationAggregator;
import IA.SystemClock;
import Simulation.CustomerSimulator;
import Simulation.KitchenSimulator;
import Simulation.OrderSimulator;
import invoker.Invoker;
import system_interface.SystemInterface;

public class Restaurant {

    public static void main(String[] args) {
        InformationAggregator ia = new InformationAggregator();
        Invoker invoker = new Invoker(ia);
        SystemInterface si = new SystemInterface(invoker);
        generateMenu(si);
        // Hostess: Handle wait and seating per clock tick
        // generate new customers
        CustomerSimulator hostess = new CustomerSimulator(ia);
        SystemClock.getInstance().AddObserver(hostess);
        OrderSimulator.getInstance().SetStrategy(OrderSimulator.GenericOrderStrategyInstance());

        //Kitchen: Order Queue, which then delivers, and finalizes table
        KitchenSimulator kitchen = new KitchenSimulator(ia.getKitchenQueue());
        SystemClock.getInstance().AddObserver(kitchen);

        // Create and Display Simulation and Manager GUI's
        SimulatorGUI simGUI = new SimulatorGUI(si, hostess, kitchen, ia);
        simGUI.setVisible(true);

        // Start the clock
        new Thread(SystemClock.getInstance()).run();
    } // end main

    static void generateMenu(SystemInterface s) {
        /*
         * Generates a list of items and add to menu String in the form of
         * name/description/basePrice/dishesAvail/prepTime
         */
        String[] list = new String[10];
        list[0] = "Baked Potato/Idaho russet baked with butter/1.95/100/15";
        list[1] = "Baked Meatloaf/Top ground round with 13 herbs and spices/9.95/10/20";
        list[2] = "Kung Pao Chicken/Chicken stir fried with a spicy Pao/8.95/100/12";
        list[3] = "Steamed White Rice/Steamed white rice/1.95/100/3";
        list[4] = "Sauteed Green Beans/Green beans sauteed with garlic/0.95/100/5";
        list[5] = "Cold Fish/Cold fish of the week/7.95/20/10";
        list[6] = "Burnt Steak/Finest cut of the Bull, Charred/11.95/25/15";
        list[7] = "Apple Pie/Nothing fancy apple pie/2.95/100/5";
        list[8] = "Coconut Creme Pie/Classic Creme pie made with real coconut/2.95/24/6";
        list[9] = "Lemon Pie/Lemon pie/2.95/24/4";
        for (int i = 0; i < list.length; i++) {
            s.addItem(list[i]);
        } // end for
    }// end generateMenu
} // end Restaurant class